package net.zjitc.service.impl;

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import net.zjitc.mapper.CategoryMapper;
import net.zjitc.pojo.Category;
import net.zjitc.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class CategoryServiceImpl implements CategoryService
{
    @Autowired
    private CategoryMapper categoryMapper;


    @Override
    public List<Category> getCategoryList() {
//        return categoryMapper.selectList(null);
        return categoryMapper.getCategoryList();
    }


    @Override
    public Category findCategoryById(Integer id) {
        return categoryMapper.findCategoryById(id);
    }

    @Override
    public void add(Category category) {
//        if(category.getId() == null){
//            category.setPid(0);
//        }
        categoryMapper.add(category);
    }

    @Override
    public void delete(Integer id) {
        categoryMapper.delete(id);
    }

    @Override
    public void update(Category category) {
        categoryMapper.update(category);

    }
}
